﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Global;
using System.Configuration;
namespace AccessLayer
{
    public class ConnInfo
    {
        static string server;

        public static string Server
        {
            
            get { return ConnInfo.server; }
            set { ConnInfo.server = value; }
        }
        static string user;

        public static string User
        {
            get { return ConnInfo.user; }
            set { ConnInfo.user = value; }
        }
        static string pwd;

        public static string Pwd
        {
            get { return ConnInfo.pwd; }
            set { ConnInfo.pwd = value; }
        }
        static string data;

        public static string Data
        {
            get { return ConnInfo.data; }
            set { ConnInfo.data = value; }
        }
        public static void SetInfo(string pServer, string pUser, string pPass, string pData)
        {
            server = pServer;
            user = pUser;
            pwd = pPass;
            data = pData;
        }
        public static void SetConnection(int i)
        {
            i *= 4;
            SetInfo(GlobalVariable.LstParam[i],
                GlobalVariable.LstParam[i + 1],  GlobalVariable.LstParam[i + 2],
                GlobalVariable.LstParam[i + 3]);
        }
        static string db;

        public static string Db
        {
            get { return ConnInfo.db; }
            set { ConnInfo.db = value; }
        }
        public static string cnn()
        {
            return ConfigurationManager.ConnectionStrings["cnn_" + db].ConnectionString;
        }
    }
}
